package com.gtguigu4.search_sort.exer2;

/**
 * ClassName: LinearSeachTest
 * Package: com.gtguigu4.search_sort.exer2
 * Description:
 *
 * @Author BuTang
 * @Create 2023/2/24 19:50
 * @Version 1.0
 */
public class LinearSeachTest1 {
    public static void main(String[] args) {
        int[] arr = new int[]{1,2,3,4,5,6,7,8,9};

        int target = 5;

        boolean isFlag = false;
        for (int i = 0; i < arr.length; i++) {
            if (i == target) {
                System.out.println("找到了");
                isFlag = true;
            }
        }
        if (isFlag == false) {
            System.out.println("不好意思，没有找到对应的元素");
        }
    }
}
